package cn.com.lms.business.learning.persistence.entity.vo;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.util.Date;

/*
 * @author liuwei
 * @date 2020/4/24 9:41
 * @desc //阶段查看-用户答题详情列表
 */
@Data
public class StageUserExamListVo {
    @Schema(description = "阶段详情ID")
    private Long detailId;
    @Schema(description = "试卷|问卷ID")
    private Long objId;
    @Schema(description = "用户ID")
    private Long userId;
    @Schema(description = "用户名称")
    private String userName;
    @Schema(description = "是否备案")
    private String isRecord;
    @Schema(description = "部门名称")
    private String deptName;
    @Schema(description = "最近交卷时间")
    private Date lastStudyTime;
    @Schema(description = "考试成绩")
    private Number grade;
    @Schema(description = "通过分数")
    private Number adoptScore;
    @Schema(description = "测验次数")
    private Number examNum;
    @Schema(description = "状态")
    private String stateText;
    @Schema(description = "问卷名称")
    private String questionName;
    @Schema(description = "问卷描述")
    private String questionDesc;


    public Number getGrade() {
        return grade;
    }

    public void setGrade(Number grade) {
        this.grade = grade;
    }

    public Number getAdoptScore() {
        return adoptScore;
    }

    public void setAdoptScore(Number adoptScore) {
        this.adoptScore = adoptScore;
        if (null != grade) {
            if (grade.intValue() <= adoptScore.intValue()) {
                this.stateText = "未通过";
            }
            if (grade.intValue() >= adoptScore.intValue()) {
                this.stateText = "通过";
            }
        }
    }

    public Date getLastStudyTime() {
        return lastStudyTime;
    }

    public void setLastStudyTime(Date lastStudyTime) {
        this.lastStudyTime = lastStudyTime;
        if (null == lastStudyTime) {
            this.stateText = "未参加";
        } else {
            this.stateText = "已参加";
        }
    }
}
